#include "wet.h"

/*
This function adds new question to the DB.
The functions assigns id = m + 1 to the question where m is maximal id of questions in the DB.
Parameters:
question - the question
username - name of the user who asks the question
data	 - date when the question asked. The date is in mm-dd-yyy format.

Output:
Row with new question. Using wet.h macros.

Return value:
Any type you can use for your puproses.

Assumptions: 
date format is valid.

Restrictions:
No question can be added on same date.

Error cases:
- print EXIST_RECORD if question of same asker on same date - already exists.
*/
void* addQuestion(const char* question, const char* username, const char* date)
{
	return NULL;
}

/*
This function edits question which exists in DB.
Parameters:
qid		 	- id of question
question  	- the edited question

Output:
Row with edited question. Using wet.h macros.

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
N/A

Error cases:
- print ILL_PARAMS if question with qid not exists in DB
*/
void* editQuestion(const int qid, const char* question)
{
	return NULL;
}

/*
This function deletes existing question from the DB.
Parameters:
qid 	-  id of question.

Output:
N/A

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
N/A

Error cases:
- print ILL_PARAMS if question with qid not exists in DB.
*/
void* deleteQuestion(const int qid)
{
	return NULL;
}

/*
This function adds tag to existing question in the DB.
Parameters:
qid 	- id of question the tag should be added to it.
tag 	- the tag to add

Output:
All tags of the given question. Using wet.h macros

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
N/A

Error cases:
- print ILL_PARAMS if question with qid not exists in DB.
- print EXISTING_RECORD if this tag already linked to the question.
*/
void* addTag(const int qid, const char* tag)
{
	return NULL;
}

/*
This function removes tag from the existing question in the DB.
Parameters:
qid		 - id of question
tag		 - the tag to remove

Output:
All tags of the given question. Using wet.h macros

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
N/A

Error cases:
- print ILL_PARAMS if question with qid not exists in DB.
- print ILL_PARAMS if tag not linked to the question with qid.
*/
void* removeTag(const int qid, const char* tag)
{
	return NULL;
}

/*
This function prints all tags of the existing question in the DB.
Parameters:
qid		 - id of question

Output:
All tags of the given question. Using wet.h macros

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
N/A

Error cases:
- print ILL_PARAMS if question with qid not exists in DB.
- print EMPTY if not tags are linked to the question with qid.
*/
void* printTags(const int qid)
{
	return NULL;
}

/*
This function adds answer to the question with given id.
The function assigns id = m + 1 to the answer where m is maximal id of the answers in the DB.
Parameters:
qid		 - id of question
answer	 - answer to add

Output:
Row with new answer. Using wet.h macros.

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
N/A

Error cases:
- print ILL_PARAMS if question with qid not exists in DB.
- print EMPTY if not tags are linked to the question with qid.
*/
void* addAnswer(const int qid, const char* answer)
{
	return NULL;
}

/*
This function edits existing answer with given id.
Parameters:
aid		 - id of answer
answer	 - edited answer

Output:
Row with new answer. Using wet.h macros.

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
N/A

Error cases:
- print ILL_PARAMS if answer with aid not exists in DB.
- print EMPTY if not tags are linked to the question with qid.
*/
void* editAnswer(const int aid, const char* answer)
{
	return NULL;
}

/*
This function deletes existing answer with given id.
Parameters:
aid		 - id of answer

Output:
N/A

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
N/A

Error cases:
- print ILL_PARAMS if answer with aid not exists in DB.
*/
void* deleteAnswer(const int aid)
{
	return NULL;
}

/*
This function approves answer with given id.
The meaning of "approves" is: #approves is increased by 1.

Parameters:
aid		 - id of answer

Output:
Row with answer which contains increased #approves. Using wet.h macros.

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
N/A

Error cases:
- print ILL_PARAMS if answer with aid not exists in DB.
*/
void* approveAnswer(const int aid)
{
	return NULL;
}

/*
This function finds all answers to question with given id.
Parameters:
qid		 - id of question

Output:
All rows with answers to the question. Using wet.h macros.

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
The answers are sorted:
prio 1: by #approves
prio 2: by aid

Error cases:
- print ILL_PARAMS if question with qid not exists in DB.
- print EMPTY if no answers exist for question with qid.
*/
void* findAnswers(const int qid)
{
	return NULL;
}

/*
This function finds all questions which linked to the tag.
Parameters:
tag		 - the tag to which the questions are related.

Output:
All rows with questions linked to the tag. Using wet.h macros.

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
The questions are sorted:
prio 1: by qid

Error cases:
- print ILL_PARAMS if tag not exists in DB.
- print EMPTY if no questions are linked for given tag.
*/
void* searchByTag(const char* tag)
{
	return NULL;
}

/*
This function finds all related tags to the given tag.
Definition: two tags t1, t2 are related if there exists a question q that t1, t2 are linked to q.
Parameters:
tag		 - the given tag.

Output:
All rows with tags related to the tag. Using wet.h macros.

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
The tags are sorted:
prio 1: by lexicographical order

Error cases:
- print ILL_PARAMS if tag not exists in DB.
- print EMPTY if no tags are related for given tag.
*/
void* findRelatedTags(const char* tag)
{
	return NULL;
}

/*
This function finds all related questions to the given question.
Definition: two questions q1, q2 are related if there exists a tag t that linked to q1, q2.
Parameters:
qid		 - id of question

Output:
All rows with questions which related to given qid. Using wet.h macros.

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
The questions are sorted:
prio 1: by qid

Error cases:
- print ILL_PARAMS if qid not exists in DB.
- print EMPTY if no questions are related for given qid.
*/
void* findRelatedQuestions(const int qid)
{
	return NULL;
}

/*
This function prints statistics about all tags in the DB.
For each tag the format is:
- tag.
- #questions linked to the tag.
- #questions linked to the tag which have an answer.
- #questions linked to the tag which does not have an answer.
- #related tags
Parameters:
N/A

Output:
All rows with statistics described above.

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
N/A

Error cases:
- print EMPTY if no tags are in the system.
*/
void* printStatistics()
{
	return NULL;
}

/*
This function prints interesting tags in the system.
The meaning of interesting tags is tags which have maximal measure of interest.
Measure of interest is: #questions linked to the tag + #answers to these questions + #approves for these answers
Parameters:
N/A

Output:
All rows with tags and linked questions to them.

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
The questions which linked to the tags are sorted.
prio 1: by tags (lexicographical order)
prio 2: by qid

Error cases:
- print EMPTY if no tags are in the system.
*/
void* interestingTags()
{
	return NULL;
}

/*
This function prints all questions which are linked to the tag
and all best answers to these questions.
The answer is best if it has maximal #approves.
Parameters:
tag	 - the tag to print the questions with best answers for it.

Output:
All rows with questions and best answers for them.

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
The questions with best answers are sorted.
prio 1: by qid
prio 2: by aid

Error cases:
- print ILL_PARAMS if tag not exists in system.
- print EMPTY if no questions are linked for the tag.
*/
void* bestAnswersForTag(const char* tag)
{
	return NULL;
}

/*
This function deletes all redundant answers in the system.
Definition: the answer a for question q is redundant if there exists another answer a' to q s.t. #approves(a') > #approves(a).

Parameters:
N/A

Output:
N/A

Return value:
Any type you can use for your puproses.

Assumptions: 
N/A

Restrictions:
N/A

Error cases:
N/A
*/
void* deleteRedundantAnswers()
{
	return NULL;
}
